#include <jni.h>
#include <string>
#include "iostream"
#include "android/log.h"
#include "myopencv//btmpHandler.h"
#include "myopencv/facedetectorHandler.h"
#include "myopencv/facedetector.h"

#define LOG_TAG "native-lib.cpp"
#define LOGEI(...) __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__)



extern "C"
JNIEXPORT void JNICALL
Java_com_example_ndk_1demo_MainActivity_loadFaceDetector(JNIEnv *env, jobject thiz,
                                                         jstring file_path) {
    // TODO: implement loadFaceDetector()
    const char *filepath = env->GetStringUTFChars(file_path, 0);

    // TODO
    facedetector::loadcascade(const_cast<char *>(filepath));
    env->ReleaseStringUTFChars(file_path, filepath);
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_example_ndk_1demo_MainActivity_facedetector(JNIEnv *env, jobject thiz, jobject bitmap) {
    // TODO: implement facedetector()
    return detectorfacehandler(env,bitmap);
}
extern "C"
JNIEXPORT jstring JNICALL
Java_com_example_ndk_1demo_MainActivity_stringFromJNI(JNIEnv *env, jobject thiz) {
    // TODO: implement stringFromJNI()
    return NULL;
}
extern "C"
JNIEXPORT jobject JNICALL
Java_com_example_ndk_1demo_MainActivity_bmp2gray(JNIEnv *env, jobject thiz, jobject bitmap) {
    // TODO: implement bmp2gray()
    return bmp2grayhandler(env,thiz,bitmap);
}